package com.exam.sacrifice.ui.mine;

import android.os.Handler;
import android.text.TextUtils;
import android.view.View;

import com.exam.commonbiz.base.BaseActivity;
import com.exam.commonbiz.base.BaseViewModel;
import com.exam.commonbiz.util.OnFastClickListener;
import com.exam.commonbiz.util.ToastUtil;
import com.exam.sacrifice.R;
import com.exam.sacrifice.databinding.ActivityFeedbackBinding;
import com.mt.mtloadingmanager.LoadingDialog;

public class FeedbackActivity extends BaseActivity<BaseViewModel, ActivityFeedbackBinding> {

    @Override
    public void initData() {

        binding.include.tvTitle.setText("意见反馈");
        binding.include.ivback.setOnClickListener(new OnFastClickListener() {
            @Override
            public void onFastClick(View v) {
                finish();
            }
        });

        binding.btnSubmit.setOnClickListener(new OnFastClickListener() {
            @Override
            public void onFastClick(View v) {
                String content = binding.edtContent.getText().toString();
                if (TextUtils.isEmpty(content)) {
                    ToastUtil.getInstance().showToast("内容不能为空");
                    return;
                }
                loadingManager.show("正在提交中");

                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        loadingManager.hideSuccess("提交成功", new LoadingDialog.OnDialogDismissedListener() {
                            @Override
                            public void onDialogDismissed() {
                                finish();
                            }
                        });
                    }
                }, 1500);
            }
        });
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_feedback;
    }
}